//
//  AYSPlayerView.m
//  AiYingShiProject
//
//  Created by lanou on 15/11/3.
//  Copyright © 2015年 李晓理. All rights reserved.
//

#import "AYSPlayerView.h"

@implementation AYSPlayerView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = [UIColor clearColor];
        
        UIButton *goBackButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
        goBackButton.frame = CGRectMake(0, 0, 100, 30);
        [goBackButton setTitle:@"返回" forState:(UIControlStateNormal)];
        [goBackButton addTarget:self action:@selector(didClickGoBack:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:goBackButton];
        
        UIButton *playAndPauseButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        playAndPauseButton.frame = CGRectMake(CGRectGetMidY(self.frame) - 30, CGRectGetMaxX(self.frame) - 40, 30, 30);
        [playAndPauseButton setImage:[UIImage imageNamed:@"感叹号"] forState:(UIControlStateNormal)];
//        playAndPauseButton.backgroundColor = [UIColor redColor];
        [playAndPauseButton addTarget:self action:@selector(didClickPlayAndPause:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:playAndPauseButton];
    }
    return self;
}

- (void)didClickPlayAndPause:(UIButton *)sender
{
    _clickPlayAndPauseBlock(sender);
}

- (void)didClickGoBack:(UIButton *)sender
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"clickGoBackButton" object:nil];
}

@end
